#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/wait.h>
#include<string.h>
#include<stdlib.h>

#define NUM 16
int main()
{
    pid_t id=fork();
    if(id==0)
    {
        printf("子进程开始替换,pid:%d\n",getpid());
   //   //  char *const argv[NUM]={
   //   //      (char*)"ls",
   //   //      (char*)"-i",
   //   //      (char*)"-l",
   //   //      NULL
   //     };
       // execl("/usr/bin/ls","ls","-i","-l",NULL);
        //execlp("ls","ls","-i","-l",NULL);
      // execvp("ls",argv);
     // execl("./mycmd","mycmd","-b",NULL);
        char *const _env[5]={
            (char*)"ENDIO_S=1234567689",
            NULL 
        };
      execle("./mycmd","mycmd","-b",NULL,_env);
     
        exit(1);
    }
    else 
    {
        int status=0;
        pid_t rel=waitpid(id,&status,0);
        printf("父进程,退出码：%d\n",WEXITSTATUS(status));
    }


    return 0;
}
